import Vue from 'vue'
import VueRouter from 'vue-router'
import allRoutes from './allRoutes'

Vue.use(VueRouter)

const routes = [{
    path: "/",
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register')
  },
  {
    path: '/editor',
    name: 'Editor',
    component: () => import('../views/Editor')
  },
  {
    path: "/home",
    name: 'Home',
    component: () => import('../views/Home'),
    children: allRoutes
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/Editor/about.vue')
  },
  {
    path: '/addpage',
    name: 'AddPage',
    component: () => import('../views/Editor/page.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router